<template>
  <div>
    <Form :validOnChange="true" :model="model">
      <FormItem label="连接地址">
        <input v-model="model.ip" type="text" />
      </FormItem>
      <FormItem label="连接端口">
        <input v-model="model.port" type="text" />
      </FormItem>
      <FormItem label="连接类型">
        <Select v-model="model.connType" :datas="connType"></Select>
      </FormItem>
      <FormItem label="报文长度">
        <input v-model="model.dataLen" type="text" />
      </FormItem>
      <FormItem label="数据类型">
        <Select v-model="model.dataType" :datas="dataType"></Select>
      </FormItem>
    </Form>
    <div slot="footer">
      <Button :block="true" text-color="primary" @click="save">确认</Button>
    </div>
    <br />
  </div>
</template>
<script>
export default {
  data() {
    return {
      connType: [
        {
          keyId: "short",
          title: "短连接",
        },
        // {
        //   keyId: "long",
        //   title: "长连接",
        // },
      ],
      dataType: [
        { keyId: "list", title: "JSON集合" },
        { keyId: "object", title: "JSON对象" },
        { keyId: "string", title: "字符文本" },
        { keyId: "bytes", title: "文件流" },
      ],
      model: {},
    };
  },
  methods: {
    initInfo(data) {
      if (!!data) {
        this.model = data;
      }
    },
    save() {
      this.$emit("setContent", this.model);
    },
  },
  deactivated() {
    this.$destroy(true);
  },
};
</script>
